package com.zx.zxblog.service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zx.zxblog.entity.pojo.Message;
import com.zx.zxblog.entity.vo.MessageVO;
import com.zx.zxblog.mapper.MessageMapper;
import com.zx.zxblog.service.MessageService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * className=MessageServiceImpl
 * package=com.zx.zxblog.service.Impl
 * description:
 *
 * @Author:SKEZhi
 * @Create:2024/4/17 - 11:06
 * @Version: v1.0
 */
@Service
public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message>
        implements MessageService{


    @Autowired
    private MessageMapper messageMapper;

    private final Logger logger = LoggerFactory.getLogger(this.getClass());


    @Override
    public PageInfo<MessageVO> getMessageList(Integer pageNum) {
        PageHelper.startPage(pageNum, 10);
        PageHelper.orderBy("create_time desc");
        List<MessageVO> messageList = messageMapper.getMessageList();//获取根评论列表

        PageInfo<MessageVO> pageInfo = new PageInfo<>(messageList, 5);

        return pageInfo;
    }


}